/*
 * BinaryOperatorAst.cpp
 *
 *  Created on: 30 Oct 2010
 *      Author: kn308
 */
#include <stdexcept>
#include "BinaryOperatorAst.h"

namespace MAlice
{

BinaryOperatorAst::BinaryOperatorAst(const std::string& operatorName,
		ExpressionAst* lhs, ExpressionAst* rhs) :
	OperatorAst(operatorName), mLHS(lhs), mRHS(rhs)
{

}

BinaryOperatorAst::~BinaryOperatorAst()
{
}

void BinaryOperatorAst::checkType(llvm::Value*& LHS, llvm::Value*& RHS)
{
	if (LHS->getType() != RHS->getType())
	{
		throw std::runtime_error(
				string("LHS ") + getOperator()
						+ " RHS: both sides of the equation don't share the same type! Automatic type casting in not implemented yet");
	}
}
}
